<template>
  <div class="common-card" :class="{ active: active }">
    <div class="title" v-if="title">
      <div class="common-title" :class="{ active: active }">
        <div class="left">
          <span>{{ title }}</span>
          <slot name="left"></slot>
        </div>
        <div class="right">
          <slot name="right"></slot>
        </div>
      </div>
    </div>
    <div class="common-content" :class="{ active: !title }" :style="cardStyle">
      <slot name="content"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "MyCardComponent",
  props: {
    title: String,
    cardStyle: [Object, Array],
    active: Boolean,
  },
  mounted() {},
  methods: {},
};
</script>

<style lang="scss" scoped>
.common-title {
  display: flex;
  justify-content: space-between;
  .left,
  .right {
    display: flex;
    align-items: center;
    flex: 1;
    span {
      white-space: nowrap;
    }
  }
  .right {
    justify-content: flex-end;
  }
}
.common-content {
  padding: 0 10rem 10rem;
  &.active {
    padding: 10rem;
  }
}
</style>